package com.seventh.parkingrent.commens;

import lombok.Data;

@Data
public class Result {

    private boolean success;

    private String message;

    private String code;

    private Object data;

    public Result() {
    }

    public Result(boolean success, String message, String code, Object data) {
        this.success = success;
        this.message = message;
        this.code = code;
        this.data = data;
    }

    public static Result success(){
        return success(null);
    }

    public static Result success(Object data){
        return new Result(true,"执行成功","0000",data);
    }

    public static Result success(String message){
        return new Result(true,message,"0000",null);
    }

    public static Result fail(String code, String message){
        return new Result(false,message,code,null);
    }

    public static Result fail(String message){
        return fail("9999",message);
    }

    public static Result fail(){
        return fail("9999","执行失败");
    }
}